import QtQuick 2.2
/*
* 进行桌面开发，难免要处理鼠标事件。即便在Android手机上，触摸事件也可以通过鼠标事件处理。
*/

Rectangle {
	width: 320;
	height: 240;

	MouseArea {
		anchors.fill: parent;
		acceptedButtons: Qt.LeftButton | Qt.RightButton;
		onClicked: {
			if(mouse.button == Qt.RightButton) {
				Qt.quit();
			}
			else if(mouse.button == Qt.LeftButton) {
				color = Qt.rgba((mouse.x % 255)/255.0,(mouse.y % 255)/255.0,0.6,1.0);
			}
		}
		onDoubleClicked: {
			color = "gray";
		}
	}
}
